package notes.java.basic.demo;

/**
 * 代码加载顺序测试
 * 
 * @author Administrator
 *
 */
public class ClassLoadSortTest extends Parent {
	public static void subStatic() {
		System.out.println("子类静态方法");
	}

	static {
		System.out.println("子类静态代码块");
	}

	public ClassLoadSortTest() {
		System.out.println("子类构造方法");
	}

	@Override
	public void todo() {
		System.out.println("子类普通方法");
	}

	{
		System.out.println("子类非静态代码块");
	}

	public static void main(String[] args) {
		ClassLoadSortTest test = new ClassLoadSortTest();
		test.todo();
	}

}

// 父类
class Parent {

	public static void parentStatic() {
		System.out.println("父类静态方法");
	}

	static {
		System.out.println("父类静态代码块");
	}

	public Parent() {
		System.out.println("父类构造方法");
	}

	public void todo() {
		System.out.println("父类普通方法");
	}

	{
		System.out.println("父类非静态代码块");
	}
}
